//
// crbet.cpp
//

#include "lib.h"
#include "crbet.h"

#ifndef USE_SQL
#include "casino.h"
#include "app.h"
#endif

// this order must match the enum BetTypes order exactly!
static String BetNames[CrapsBet::NUMBETS];

void 
initBetNames()
{
#ifndef USE_SQL
	// Load String bet names from table
	for( short i = 0; i < CrapsBet::NUMBETS && BetNames[i].isEmpty(); i++ )
	{
		String sName;
		sName.sprintf( "CrapsBet_%d", i+1 );

		BetNames[i] = CApp::GetString(sName);
	}
#endif
}

CrapsBet::CrapsBet()
{
	m_betID			= (uint8)-1;
	m_amount		= 0;
	m_bonusAmount	= 0;

	m_dependant		= (CrapsBet *)0;

	m_grandfathered	= false;

	initBetNames();
}

CrapsBet::CrapsBet(uint8 betID)
{
	m_betID			= betID;
	m_amount		= 0;
	m_bonusAmount	= 0;

	m_dependant		= (CrapsBet *)0;

	m_grandfathered	= false;

	initBetNames();
}

CrapsBet::CrapsBet(uint8 betID, int32 amount, int32 bonusAmount)
{
	m_betID			= betID;
	m_amount		= amount;
	m_bonusAmount	= bonusAmount;

	m_dependant		= (CrapsBet *)0;

	m_grandfathered	= false;

	initBetNames();
}


CrapsBet::CrapsBet(const CrapsBet &bet)
{
	operator=(bet);

	initBetNames();
}



CrapsBet&
CrapsBet::operator=(const CrapsBet &bet)
{
	m_betID			= bet.m_betID;
	m_amount		= bet.m_amount;
	m_bonusAmount	= bet.m_bonusAmount;
	m_dependant		= bet.m_dependant;
	m_grandfathered	= bet.m_grandfathered;

	return *this;
}


int32
CrapsBet::getLimit(uint8 point, int32 maxLimit)
{
	return maxLimit;
}

const String&
CrapsBet::getName(uint8 betID)
{
	ASSERT(betID >= 0 && betID <= CrapsBet::NUMBETS);

	return BetNames[betID];
}

CrapsBet *
CrapsBet::getDependent()
{
	return m_dependant;
}

////////////////
//  depends   //
////////////////

DependsBet&
DependsBet::operator=(const DependsBet &bet)
{
	m_betID			= bet.m_betID;
	m_amount		= bet.m_amount;
	m_bonusAmount	= bet.m_bonusAmount;
	m_depends		= bet.m_depends;
	m_dependant		= bet.m_dependant;
	m_grandfathered	= bet.m_grandfathered;

	return *this;
}

DependsBet::DependsBet(uint8 betID, const DependsBet &bet) : CrapsBet(betID)
{
	operator=(bet);
}

////////////
//  odds  //
////////////

OddsBet&
OddsBet::operator=(const OddsBet &bet)
{
	m_betID			= bet.m_betID;
	m_amount		= bet.m_amount;
	m_bonusAmount	= bet.m_bonusAmount;
	m_depends		= bet.m_depends;
	m_oddsMult		= bet.m_oddsMult;
	m_dependant		= bet.m_dependant;
	m_grandfathered	= bet.m_grandfathered;

	return *this;
}

OddsBet::OddsBet(uint8 betID, const OddsBet &bet) : DependsBet(betID, bet)
{
	operator=(bet);
}


/////////////
//  pass   //
/////////////

PassBet::PassBet(uint8 betID, const PassBet &bet) : CrapsBet(betID)
{
	operator=(bet);
}

///////////////////
//  don't pass   //
///////////////////
DontPassBet::DontPassBet(uint8 betID, const DontPassBet &bet) : CrapsBet(betID)
{
	operator=(bet);
}

//////////////
//  field   //
//////////////

FieldBet::FieldBet(uint8 betID, const FieldBet &bet) : CrapsBet(betID)
{
	operator=(bet);
}

////////////
//  big   //
////////////

BigBet::BigBet(uint8 betID, const BigBet &bet) : CrapsBet(betID)
{
	operator=(bet);
}

/////////////
//  come   //
/////////////

ComeBet::ComeBet(uint8 betID, const ComeBet &bet) : CrapsBet(betID)
{
	operator=(bet);
}

/////////////////////
//  come specific  //
/////////////////////

ComeSpecificBet::ComeSpecificBet(uint8 betID, const ComeSpecificBet &bet) : CrapsBet(betID)
{
	operator=(bet);
}

////////////
//  buy   //
////////////

BuyBet::BuyBet(uint8 betID, const BuyBet &bet) : CrapsBet(betID)
{
	operator=(bet);
}

//////////////
//  place   //
//////////////

PlaceBet::PlaceBet(uint8 betID, const PlaceBet &bet) : CrapsBet(betID)
{
	operator=(bet);
}

//////////////////
//  place lose  //
//////////////////

PlaceLoseBet::PlaceLoseBet(uint8 betID, const PlaceLoseBet &bet) : CrapsBet(betID)
{
	operator=(bet);
}


//////////////
//  lay   //
//////////////

LayBet::LayBet(uint8 betID, const LayBet &bet) : CrapsBet(betID)
{
	operator=(bet);
}

/////////////
//  hard   //
/////////////

HardBet::HardBet(uint8 betID, const HardBet &bet) : CrapsBet(betID)
{
	operator=(bet);
}

/////////////////
//  one-time   //
/////////////////

OneTimeBet::OneTimeBet(uint8 betID, const OneTimeBet &bet) : CrapsBet(betID)
{
	operator=(bet);
}


//
// end of file
//